// Copyright 2006 Mloofle Inc. All Rights Reserved.

/**
 * An abstract interface for receiving the output of
 * {@link WordLexer#processInput(InputStream, WordParser)}. Each word in the
 * input is passed into {@link #processWord(String)} sequentially.
 */
public interface WordParser {

  /**
   * Records statistics regarding the end of the stream.
   * 
   * @param totalBytes the total number of bytes in the stream
   * @param totalLines the total number of lines in the stream
   */
  void endOfStream(int totalBytes, int totalLines);

  /**
   * Processes the next word in the input.
   * 
   * @param word the next word to process
   * @param lineNumber the line number on which the word appears
   */
  void processWord(String word, int lineNumber);

}
